home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / online.pas < prev    next >
Pascal/Delphi Source File  |  1991-09-17  |  1KB  |  29 lines

  1. This function will return true if Printer 0 is online.  If you want to
  2. check a different printer number, add a Word parameter (b) and then 
  3. change the MOV DX, 00H to MOV DX, b.  I haven't tried using a different
  4. printer number but **theoretically** it should work.
  5.  
  6. I also admit to being a novice BASM user.  So far this has worked on my
  7. system returning the correct value for CheckOnLine based on the printer's
  8. status, but don't trust my work.  Try it out yourself and let me know if 
  9. I messed this up!
  10.  
  11.  
  12. Function CheckOnline : Boolean; Assembler;    {Requires TP 6.0 BASM}
  13.  
  14. ASM
  15.    MOV      AH, 02H     {Int 17,  Service 2 for printer status}
  16.    MOV      AL, 00H     {just playing it safe, probably not needed}
  17.    MOV      DX, 00H     {printer 0}
  18.    INT      17H
  19.    MOV      AL, 00H     {set checkonline false}
  20.    TEST     AH, 10H     {if bit 4 is set z flag=0, if not z flag=1}
  21.    JZ       @No         {leave function false if z flag is set}
  22.    INC      AL
  23.    @No:
  24. END;
  25.  
  26. Don Bibb
  27. CIS ID# 70244, 3236
  28. 8/24/91
  29.